package com.jboy.test;

public class HashCodeConflict2 {
    private String id;

    public HashCodeConflict2(String id) {
        this.id = id;
    }



    // 故意不重写hashCode()方法

    public static void main(String[] args) {
        HashCodeConflict2 a = new HashCodeConflict2("123");
        HashCodeConflict2 b = new HashCodeConflict2("123");

        System.out.println("equals结果: " + a.equals(b)); // 输出true
        System.out.println("a的hashCode: " + a.hashCode()); // 默认内存地址哈希值
        System.out.println("b的hashCode: " + b.hashCode()); // 不同内存地址哈希值
    }
}
